package com.fz.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fz.entity.PropertyFee;
import com.fz.entity.Repair;
import com.fz.mapper.PropertyFeeMapper;
import com.fz.service.PropertyFeeService;
import com.fz.service.RepairService;
import com.fz.vo.PayVo;
import com.fz.vo.ResultVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fz
 * @since 2024-08-21
 */
@RestController
@RequestMapping("/propertyFee")
public class PropertyFeeController {
    @Resource
    PropertyFeeService propertyFeeService;

    @GetMapping("/list")
    List<PayVo> list() {
        List<PropertyFee> propertyFeeList=propertyFeeService.list();
        return propertyFeeService.setPayVoList(propertyFeeList);
    }
    @PostMapping("/list2")
    ResultVo<IPage<PropertyFee>> list(Integer pageNo, Integer pageSize){
        List<PropertyFee> propertyFeeList=propertyFeeService.list();
         propertyFeeService.setPayVoList(propertyFeeList);
        return ResultVo.success(propertyFeeService.showList(pageNo,pageSize));
    }
    @PostMapping("/llist")
    ResultVo<IPage<PropertyFee>>llist(Long userId, Integer pageNo, Integer pageSize)
    {return ResultVo.success(propertyFeeService.getList(userId, pageNo, pageSize));}

    @PostMapping("/checkt")
    ResultVo<Boolean> checkt(Integer userId){
        return ResultVo.success(propertyFeeService.checktime(userId));
    }
    @PostMapping("/add")
    Boolean add(PropertyFee propertyFee) {
        return propertyFeeService.save(propertyFee);
    }

    @GetMapping("/check")
    ResultVo<Boolean> check(Long id, String field, String value){
        return ResultVo.success(propertyFeeService.check(id,field,value));
    }
}
